package view;

import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;

import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JFrame;

import model.FileParser;
import model.Manuscript;
import model.State;
import model.User;

/**
 * @author Sarah George
 *
 */
@SuppressWarnings("serial")
public class AssignSPCAction extends AbstractAction {
	
	private User my_user;
	private Manuscript my_paper;
	private JFrame my_frame;
	private State my_state;
	
	public AssignSPCAction(User the_user, Manuscript the_paper, JFrame the_frame, State the_state) {
		super("Assign");
	    putValue(Action.MNEMONIC_KEY, KeyEvent.VK_A);
	    putValue(Action.SELECTED_KEY, true);
		my_user = the_user;
		my_paper = the_paper;
		my_frame = the_frame;
		my_state = the_state;
	}

	@Override
	public void actionPerformed(ActionEvent arg0) {
		FileParser fp = my_state.getParser();
		int spc_id = my_user.getID();
		my_paper.setMy_SPC(spc_id);
		fp.setSPC(my_paper,spc_id);
		my_frame.dispose();
		//if spc chosen is listed as a reviewer in a different conf, set role as spc if chosen
	}

	
}
